<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>1F钢架E化方案 - 后台管理 - 部门添加</title>
  <%@include file="/WEB-INF/common/css.jsp"%>
  
  <%@include file="/WEB-INF/common/topjs.jsp"%>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  
  <%@include file="/WEB-INF/common/admin/header.jsp"%>
  <%@include file="/WEB-INF/common/admin/menu.jsp"%>
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
    	<div class="layui-col-md4">
    		<h3 class="layui-bg-cyan" style="height: 50px;line-height: 50px;padding-left: 5px">部门添加</h3>
			<hr>
    		<form class="layui-form" action="">
			  <div class="layui-form-item">
			    <label class="layui-form-label">部门名: </label>
			    <div class="layui-input-block">
			      <input type="text" name="name" id="name" required  lay-verify="required" placeholder="请输入部门" autocomplete="off" class="layui-input">
			    </div>
			  </div>
			 
			  <div class="layui-form-item">
			    <div class="layui-input-block">
			      <button class="layui-btn" lay-submit lay-filter="add">添加</button>
			      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
			    </div>
			  </div>
			</form>
    	</div>
    </div>
  </div>
  
  <%@include file="/WEB-INF/common/admin/footer.jsp"%>
  
</div>
<%@include file="/WEB-INF/common/bottomjs.jsp"%>
<script>
(function(){
  var form = layui.form;
  //监听提交
  form.on('submit(add)', function(data){
    $.ajax({
    	url:"${base}/admin/department/add.api",
    	type: "post",
    	headers: Apicheck.getHeaders(),
    	data: {name: data.field.name},
    	success: function(result){
    		if(result.code == 1001){
    			layer.msg(result.msg, {icon:6});
    			$("#name").val("");
    		}else{
    			layer.msg(result.msg, {icon:5,anim:6});
    		}
    	}
    });
    return false;
  });
})()

</script>
</body>
</html>